import _axios from "@/plugins/axios";

// qc分享奖励-首页奖励列表
export function rewardList() {
  return _axios({
    url: '/qc/share/reward/list',
    method: 'get'
  })
}

// qc分享奖励-申请
export function rewardApply({
  medium,
  orderNo,
  shareUrl,
  source
}) {
  return _axios({
    url: "/qc/share/reward/apply",
    method: "post",
    data: {
      medium, // 媒体
      orderNo, // 相关订单号
      shareUrl, // 分享社交媒体地址
      source
    },
  });
}

// qc分享奖励-我的奖励列表
export function rewardUserList(status) {
  return _axios({
    url: '/qc/share/reward/user/list',
    method: 'get', params: {
      status
    }
  })
}


// 双11列表
export function activityList({ pageNo, pageSize, scrollId, channel }) {
  return _axios({
    url: '/product/search/activity',
    method: 'get',
    params: {
      pageNo,
      pageSize,
      scrollId,
      channel
    }
  })
}
// 双11详情
export function activityDetail({
  channel,
  spuNo
}) {
  return _axios({
    url: '/product/activity/detail',
    method: 'get',
    params: {
      channel,
      spuNo
    }
  })
}
// 双11购物车列表
export function getCartList({ source }) {
  return _axios({
    url: '/shopcart/listV3',
    method: 'get',
    params: {
      source
    }
  })
}
// 双11购物车-编辑
export function doubleCartEdit({
  channel,
  id,
  skuNo,
  quantity,
  spuNo,
  isSelected
}) {
  return _axios({
    url: '/shopcart/editV3',
    method: 'put',
    data: {
      channel, // 来源
      id, // 主键
      skuNo, // 系统商品编号/货号：系统唯一
      quantity, // 数量，必填
      spuNo, // SPU产品编号
      isSelected
    }
  })
}
// 购物车-添加
export function doubleCartAdd({ source, channel, quantity, remarks, skuNo, spuNo, expressFee, imageRemarks, manuaAdjustRemark, manuaPrice, manuaAdjustImage, manuaExpressFee, services, videoServices, notSupportQcVideos }) {
  return _axios({
    url: '/shopcart/addV3',
    method: 'post',
    data: {
      source, //1-现有平台 2-双十一活动
      channel, // 商品ID，必填
      quantity, // 数量，必填
      remarks,
      skuNo, // 商品规格id，必填
      spuNo,
      expressFee,
      imageRemarks,
      manuaAdjustRemark,//改价备注
      manuaPrice,//改价价格
      manuaAdjustImage,//改价图片
      manuaExpressFee,
      services,//定制照片
      videoServices,//定制视频
      notSupportQcVideos
    }
  })
}

// 创建事件分享短链
export function createByEvent({
  eventCode
}) {
  return _axios({
    url: "/short/link/createByEvent",
    method: "post",
    data: {
      eventCode
    },
  });
}

// 双11购物车支付校验
export function getPromotion({
  addressId,
  cartItems, //购物车商品信息集合
  remarks
}) {
  return _axios({
    url: "/order/submitV2/promotion",
    method: "post",
    data: {
      addressId,
      cartItems,
      remarks
    },
  });
}

// 双11倒计时
export function activityTime({ activityName, channel }) {
  return _axios({
    url: '/product/activity/time',
    method: 'get',
    params: {
      activityName,
      channel
    }
  })
}

// 黑五
export function shopList() {
  return _axios({
    url: '/product/activity/shop',
    method: 'get',
  })
}

export function pageUserRewardRecords({ pageNo, pageSize }) {
  return _axios({
    url: '/operationActivity/pageUserRewardRecords',
    method: 'get',
    params: {
      pageNo,
      pageSize
    }
  })
}

// 获取佣金钱包信息接口
export function getBonusWalletInfo() {
  return _axios({
    url: '/newPromoteAlliance/getBonusWalletInfo',
    method: 'get'
  })
}

// 获取当月排行榜信息
export function getMonthlyRankInfo() {
  return _axios({
    url: '/newPromoteAlliance/getMonthlyRankInfo',
    method: 'get'
  })
}

// 获取推广汇总信息接口
export function getPromoteStatInfo() {
  return _axios({
    url: '/newPromoteAlliance/getPromoteStatInfo',
    method: 'get'
  })
}

// 获取佣金配置
export function listCommissionConfig() {
  return _axios({
    url: '/newPromoteAlliance/listCommissionConfig',
    method: 'get'
  })
}

// 分页查询邀请表现列表
export function pageInvitePerformance({ pageNo, pageSize, orderBy, sort }) {
  return _axios({
    url: '/newPromoteAlliance/pageInvitePerformance',
    method: 'get',
    params: {
      pageNo,
      pageSize,
      orderBy,
      sort
    }
  })
}

// 分页查询邀请表现详情列表
export function pageInvitePerformanceDetail({ pageNo, pageSize, paidTimeStart, paidTimeEnd, paymentType, userName, bonusStatus, orderBy, sort }) {
  return _axios({
    url: '/newPromoteAlliance/pageInvitePerformanceDetail',
    method: 'get',
    params: {
      pageNo,
      pageSize,
      paidTimeStart,
      paidTimeEnd,
      paymentType,
      userName,
      bonusStatus,
      orderBy,
      sort
    }
  })
}

// 佣金转至余额
export function transferToBalance({ transferAmount }) {
  return _axios({
    url: "/newPromoteAlliance/transferToBalance",
    method: "post",
    data: { transferAmount },
  });
}

// 弹幕
export function barrageList(params) {
  return _axios({
    url: '/promoteAlliance/barrageList',
    method: 'get',
    params: params
  })
}